package com.tong.hao.ac.service.flowable.finance;

import cn.buddha.jec.flowable.core.AbstractFlowable;
import com.tong.hao.ac.api.model.in.finance.AC010001Req;
import com.tong.hao.ac.api.model.out.finance.AC010001Res;
import com.tong.hao.ac.service.component.finance.AcBillComponent;
import com.tong.hao.ac.service.domain.finance.AcBillReqDo;
import com.tong.hao.ac.service.transfer.finance.AC010001TransferReq;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName AcBillFlowable
 * @Author 友野浩二
 * @Date 2020/4/27 9:51
 * @Description 账单记录服务流程
 * @Version 1.0
 */
@Component
public class AcBillFlowable extends AbstractFlowable<AC010001Req, AC010001Res> {

    /**
     * 实体属性值复制器
     */
    @Resource
    private AC010001TransferReq ac010001TransferReqImpl;

    /**
     * 账单组件
     */
    @Resource
    private AcBillComponent acBillComponent;

    /**
     * @return com.tong.hao.ac.api.model.out.finance.AC010001Res
     * @Author 友野浩二
     * @Description // 账单登记服务流程
     * @Date 2020/5/3 15:53
     * @Param [input]
     */
    @Override
    public AC010001Res middleExecute(AC010001Req input) {
        // 请求模型数据转换(请求模型的数据转换为业务模型)
        AcBillReqDo acBillReqDo = this.ac010001TransferReqImpl.to(input);

        // 账单登记组件
        this.acBillComponent.registerAcBill(acBillReqDo);

        AC010001Res ac010001Res = new AC010001Res();
        ac010001Res.setIsSuccess(Boolean.TRUE);

        return ac010001Res;
    }
}
